com.supermap.realspace
Class SceneControl
- java.lang.Object
-
- android.view.View
-
- android.view.SurfaceView
-
- com.supermap.realspace.SceneControl
-
- All Implemented Interfaces:
- android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback
public class SceneControl extends android.view.SurfaceView
3D scene controls.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interface
SceneControl.OnUpdateListener
-
Nested classes/interfaces inherited from class android.view.View
android.view.View.AccessibilityDelegate, android.view.View.BaseSavedState, android.view.View.DragShadowBuilder, android.view.View.MeasureSpec, android.view.View.OnApplyWindowInsetsListener, android.view.View.OnAttachStateChangeListener, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnDragListener, android.view.View.OnFocusChangeListener, android.view.View.OnGenericMotionListener, android.view.View.OnHoverListener, android.view.View.OnKeyListener, android.view.View.OnLayoutChangeListener, android.view.View.OnLongClickListener, android.view.View.OnSystemUiVisibilityChangeListener, android.view.View.OnTouchListener
-
-
Field Summary
-
Fields inherited from class android.view.View
ACCESSIBILITY_LIVE_REGION_ASSERTIVE, ACCESSIBILITY_LIVE_REGION_NONE, ACCESSIBILITY_LIVE_REGION_POLITE, ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, LAYOUT_DIRECTION_INHERIT, LAYOUT_DIRECTION_LOCALE, LAYOUT_DIRECTION_LTR, LAYOUT_DIRECTION_RTL, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_IMMERSIVE, SYSTEM_UI_FLAG_IMMERSIVE_STICKY, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_GRAVITY, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_TEXT_END, TEXT_ALIGNMENT_TEXT_START, TEXT_ALIGNMENT_VIEW_END, TEXT_ALIGNMENT_VIEW_START, TEXT_DIRECTION_ANY_RTL, TEXT_DIRECTION_FIRST_STRONG, TEXT_DIRECTION_INHERIT, TEXT_DIRECTION_LOCALE, TEXT_DIRECTION_LTR, TEXT_DIRECTION_RTL, TRANSLATION_X, TRANSLATION_Y, VISIBLE, X, Y
-
-
Constructor Summary
Constructors Constructor and Description SceneControl(android.content.Context context)
Construct a 3D scene control according to the context of the current view.SceneControl(android.content.Context context, android.util.AttributeSet attrs)
Construct a new 3D scene control object according to the specified parameters.SceneControl(android.content.Context context, SceneType sceneType)
Constructor, construct a SceneControl object according to the context and SceneType.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addTrackedListener(Tracked3DListener listener)
Add tracking end event listener.void
addTrackingListener(Tracking3DListener listener)
Add tracking event listener.void
displayDistanceOrArea(Point3Ds point3Ds)
void
displayMeasure(int x, int y)
//Calculate height distance area according to screen coordinatesAction3D
getAction()
Return to 3D scene operation statusFrame
getFrame()
Get Google ARCore FrameARFrame
getFrameHW()
Get ARFrame from Huawei AREngine ARFrame @return AREngineboolean
getIsManageARSession()
Get if the Session is updated by SceneControlScene
getScene()
Return the scene object in the current scene control.Session
getSession()
Get Google ARCore SessionARSession
getSessionHW()
Get ARSession from Huawei AREngineboolean
isNavigationControlVisible()
Returns whether the navigation bar is visible.boolean
isStatusBarVisible()
Return whether the status bar is visible.boolean
onTouchEvent(android.view.MotionEvent event)
Returns whether the gesture in the current scene is received by the view.void
pauseSession()
Suspend ARSessionvoid
postRunnable(java.lang.Runnable runnable)
Add a task to the rendering thread.void
removeTrackedListener(Tracked3DListener listener)
Remove the tracking end event listener.void
removeTrackingListener(Tracking3DListener listener)
Remove tracking event listener.void
resumeSession()
Restore ARSessionvoid
sceneControlInitedComplete(SceneControlInitedCallBackListenner listenner)
Scene control initialization callback listener.void
setAction(Action3D value)
Set 3D scene operation statusvoid
setFrame(Frame frame)
Set Google ARCore Framevoid
setFrameHW(ARFrame frame)
Set up ARFrame for Huawei AREnginevoid
setGestureDetector(android.view.GestureDetector gsDetector)
Set up user gesture recognizer.void
setIsManageARSession(boolean isManage)
Set whether the SceneControl updates the sessionvoid
setNavigationControlVisible(boolean value)
Set whether the navigation bar is visible.void
setOnTouchListener(android.view.View.OnTouchListener listener)
Set up the touch monitor.void
setOnUpdateListener(SceneControl.OnUpdateListener m_onUpdateListener)
void
setSession(Session session)
Set up Google ARCore Sessionvoid
setSessionHW(ARSession session)
Set ARSession for Huawei AREnginevoid
setStatusBarVisible(boolean value)
Set whether the status bar is visible.-
Methods inherited from class android.view.SurfaceView
draw, gatherTransparentRegion, getHolder, setSecure, setVisibility, setZOrderMediaOverlay, setZOrderOnTop
-
Methods inherited from class android.view.View
addChildrenForAccessibility, addFocusables, addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, cancelLongPress, cancelPendingInputEvents, canResolveLayoutDirection, canResolveTextAlignment, canResolveTextDirection, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeScroll, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchApplyWindowInsets, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchGenericMotionEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, findFocus, findViewById, findViewsWithText, findViewWithTag, focusSearch, forceLayout, generateViewId, getAccessibilityLiveRegion, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getCameraDistance, getClipBounds, getContentDescription, getContext, getDefaultSize, getDisplay, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLabelFor, getLayerType, getLayoutDirection, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverlay, getOverScrollMode, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSystemUiVisibility, getTag, getTag, getTextAlignment, getTextDirection, getTop, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowId, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasFocus, hasFocusable, hasOnClickListeners, hasOverlappingRendering, hasTransientState, hasWindowFocus, inflate, invalidate, invalidate, invalidate, invalidateDrawable, isActivated, isAttachedToWindow, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInLayout, isInTouchMode, isLaidOut, isLayoutDirectionResolved, isLayoutRequested, isLongClickable, isOpaque, isPaddingRelative, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isTextAlignmentResolved, isTextDirectionResolved, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, jumpDrawablesToCurrentState, layout, measure, offsetLeftAndRight, offsetTopAndBottom, onApplyWindowInsets, onCancelPendingInputEvents, onCheckIsTextEditor, onCreateInputConnection, onDragEvent, onFilterTouchEventForSecurity, onFinishTemporaryDetach, onGenericMotionEvent, onHoverChanged, onHoverEvent, onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo, onKeyDown, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onPopulateAccessibilityEvent, onRtlPropertiesChanged, onScreenStateChanged, onStartTemporaryDetach, onTrackballEvent, onWindowFocusChanged, onWindowSystemUiVisibilityChanged, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestApplyInsets, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setAccessibilityLiveRegion, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setClipBounds, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLabelFor, setLayerPaint, setLayerType, setLayoutDirection, setLayoutParams, setLeft, setLongClickable, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnApplyWindowInsetsListener, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOverScrollMode, setPadding, setPaddingRelative, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSelected, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTextAlignment, setTextDirection, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, toString, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
-
-
-
-
Constructor Detail
-
SceneControl
public SceneControl(android.content.Context context)
Construct a 3D scene control according to the context of the current view.- Parameters:
context
- The context in which the current view is running, through which you can access the resources and classes of the current application, as well as some application-level operations.Please refer to the Android SDK development document for Context type description
-
SceneControl
public SceneControl(android.content.Context context, android.util.AttributeSet attrs)
Construct a new 3D scene control object according to the specified parameters.- Parameters:
context
- The context in which the current view is running, through which you can access the resources and classes of the current application, as well as some application-level operations.attrs
- XML file tag attribute collection.Please refer to the Android SDK development document for Context and AttributeSet type descriptions
-
SceneControl
public SceneControl(android.content.Context context, SceneType sceneType)
Constructor, construct a SceneControl object according to the context and SceneType.- Parameters:
context
- specifies the context.sceneType
- specifies the sceneType.
-
-
Method Detail
-
getScene
public Scene getScene()
Return the scene object in the current scene control.- Returns:
- the scene object obtained.
Note: Before obtaining the scene object, the 3D scene must be displayed.
-
getAction
public Action3D getAction()
Return to 3D scene operation status- Returns:
- The current operating state of the scene in the scene control.
-
setAction
public void setAction(Action3D value)
Set 3D scene operation status- Parameters:
value
- 3D scene operation type.
-
setGestureDetector
public void setGestureDetector(android.view.GestureDetector gsDetector)
Set up user gesture recognizer.- Parameters:
gsDetector
- Gesture recognition class object, cannot be empty.The GestureDetector class is a gesture recognition class provided by the Android SDK, which can be used to recognize different gestures such as single click, double click, long press, sliding, and dragging.
-
addTrackingListener
public void addTrackingListener(Tracking3DListener listener)
Add tracking event listener.- Parameters:
listener
- tracking event listener
-
removeTrackingListener
public void removeTrackingListener(Tracking3DListener listener)
Remove tracking event listener.- Parameters:
listener
- tracking event listener
-
addTrackedListener
public void addTrackedListener(Tracked3DListener listener)
Add tracking end event listener.- Parameters:
listener
- tracking end event listener
-
removeTrackedListener
public void removeTrackedListener(Tracked3DListener listener)
Remove the tracking end event listener.- Parameters:
listener
- tracking end event listener
-
setOnTouchListener
public void setOnTouchListener(android.view.View.OnTouchListener listener)
Set up the touch monitor.- Overrides:
setOnTouchListener
in classandroid.view.View
- Parameters:
listener
- touch listener
-
onTouchEvent
public boolean onTouchEvent(android.view.MotionEvent event)
Returns whether the gesture in the current scene is received by the view.- Overrides:
onTouchEvent
in classandroid.view.View
- Parameters:
event
- operation gesture event- Returns:
- returns true if the current gesture has been recognized, otherwise it returns false.
-
isStatusBarVisible
public boolean isStatusBarVisible()
Return whether the status bar is visible.- Returns:
- Whether the status bar is visible.
-
setStatusBarVisible
public void setStatusBarVisible(boolean value)
Set whether the status bar is visible.- Parameters:
value
- A boolean value that specifies whether the status bar is visible.
-
setNavigationControlVisible
public void setNavigationControlVisible(boolean value)
Set whether the navigation bar is visible.- Parameters:
value
- A boolean value that specifies whether the navigation bar is visible.
-
isNavigationControlVisible
public boolean isNavigationControlVisible()
Returns whether the navigation bar is visible.- Returns:
- Whether the navigation bar is visible.
-
sceneControlInitedComplete
public void sceneControlInitedComplete(SceneControlInitedCallBackListenner listenner)
Scene control initialization callback listener.- Parameters:
listenner
- specifies the listener for scene control initialization.
-
postRunnable
public void postRunnable(java.lang.Runnable runnable)
Add a task to the rendering thread.- Parameters:
runnable
- specifies a Runnable.
-
displayMeasure
public void displayMeasure(int x, int y)
//Calculate height distance area according to screen coordinates
-
displayDistanceOrArea
public void displayDistanceOrArea(Point3Ds point3Ds)
-
setOnUpdateListener
public void setOnUpdateListener(SceneControl.OnUpdateListener m_onUpdateListener)
-
pauseSession
public void pauseSession()
Suspend ARSession
-
resumeSession
public void resumeSession()
Restore ARSession
-
getSessionHW
public ARSession getSessionHW()
Get ARSession from Huawei AREngine- Returns:
- ARSession in AREngine
-
setSessionHW
public void setSessionHW(ARSession session)
Set ARSession for Huawei AREngine- Parameters:
session
- ARSession instance object
-
getSession
public Session getSession()
Get Google ARCore Session- Returns:
- Session in ARCore
-
setSession
public void setSession(Session session)
Set up Google ARCore Session- Parameters:
session
- session instance object
-
setFrame
public void setFrame(Frame frame)
Set Google ARCore Frame- Parameters:
frame
- ARCore's Frame
-
getFrame
public Frame getFrame()
Get Google ARCore Frame- Returns:
- ARCore's Frame
-
setFrameHW
public void setFrameHW(ARFrame frame)
Set up ARFrame for Huawei AREngine- Parameters:
frame
- ARFgine ARFrame
-
getFrameHW
public ARFrame getFrameHW()
Get ARFrame from Huawei AREngine ARFrame @return AREngine
-
setIsManageARSession
public void setIsManageARSession(boolean isManage)
Set whether the SceneControl updates the session- Parameters:
isManage
- is true by default
-
getIsManageARSession
public boolean getIsManageARSession()
Get if the Session is updated by SceneControl- Returns:
- Whether or not the Session is updated by SceneControl
-
-